package com.aqie.advanced.automatic.bootstrap;

import com.aqie.advanced.automatic.service.CalculateService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.ConfigurableApplicationContext;

@SpringBootApplication(scanBasePackages = "com.aqie.advanced.automatic.service")
@Slf4j
public class CalculateServiceBootstrap {
    public static void main(String[] args){
        ConfigurableApplicationContext context = new SpringApplicationBuilder(CalculateServiceBootstrap.class)
                .web(WebApplicationType.NONE)
                .profiles("Java8")
                .run(args);

        // 校验bean是否存在
        CalculateService calculateService = context.getBean(CalculateService.class);
        log.info("sum is {}", calculateService.sum(1, 2, 3, 4));
        context.close();
    }
}
